Skip to content

Annotate unstable *MAX constants#5122

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
dybucc:_max-deprecation
Jun 26, 2026
Merged

Annotate unstable *MAX constants#5122
tgross35 merged 1 commit into
rust-lang:mainfrom
dybucc:_max-deprecation

Conversation

@dybucc

@dybucc dybucc commented May 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds documentation. This affects certain symbols. These are often not stable upstream. This causes SemVer-breaking issues. Users may need advice. This patch links to such advice.

Some constants have been ignored. They are issued to sysconf.

POSIX defines clases of constants. They are part of limits.h. Some are runtime invariant. Others are not. Numerical limits have been skipped. Runtime invariant values have been skipped. Pathname variable values have been annotated. Runtime increasable values have been annotated.

POSIX-compliance has been assumed. This is sometimes broken. NetBSD is an example. They define AIO_LIST_MAX as variable [1.] This should be a runtime invariant value. This PR does not handle this.

QNX sources have not been found. Its module has been barely modified. Only some symbols have been taken into consideration. Those correspond with the above POSIX-defined symbols.

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget); especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@dybucc dybucc changed the title refactor: deprecate *MAX constants fitting rust-lang/libc#3131 refactor: deprecate *MAX constants fitting rust-lang/libc#3131 May 29, 2026
@dybucc dybucc changed the title refactor: deprecate *MAX constants fitting rust-lang/libc#3131 refactor: deprecate *MAX constants fitting #3131 May 29, 2026
@dybucc dybucc force-pushed the _max-deprecation branch 11 times, most recently from 5ee0951 to 3bc30cb Compare May 30, 2026 10:15
@dybucc dybucc marked this pull request as ready for review May 30, 2026 16:19
@rustbot

rustbot commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in an Android module

cc @maurer

Some changes occurred in an OpenBSD module

cc @semarie

Some changes occurred in a NetBSD-like module

cc @semarie

Some changes occurred in a solarish module

cc @jclulow, @pfmooney

@dybucc dybucc force-pushed the _max-deprecation branch 2 times, most recently from cb9c814 to 0141e49 Compare June 4, 2026 07:09
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@dybucc

dybucc commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

CI actually passes. There seems to be an issue with a glob import that is not used, but this has not
been changed in the patch (it's not even part of it, for that matter.) For some reason, rebasing
onto main with dependabot updates has ended up with a warning across all of my open PRs due to
that one (now apparently unused) import.

@rustbot rustbot added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Jun 9, 2026
@dybucc dybucc force-pushed the _max-deprecation branch from e284492 to 5e64324 Compare June 15, 2026 15:20
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot

rustbot commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@dybucc dybucc force-pushed the _max-deprecation branch from c6d3aaa to 3292409 Compare June 22, 2026 17:30
@rustbot

This comment has been minimized.

@dybucc dybucc force-pushed the _max-deprecation branch from 3292409 to 7253e3e Compare June 23, 2026 06:58
@rustbot

This comment has been minimized.

@dybucc dybucc force-pushed the _max-deprecation branch from 7253e3e to 1a18c7d Compare June 23, 2026 07:01
@dybucc dybucc changed the title refactor: deprecate *MAX constants fitting #3131 crate: annotate unstable *MAX constants Jun 23, 2026
@dybucc

dybucc commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@tgross35 Changes are done. The PR description has changes. It's hopefully clearer.

@rustbot ready

Comment thread src/unix/aix/mod.rs
Comment on lines 1456 to 1494
@@ -1454,14 +1490,7 @@ pub const OPEN_MAX: c_int = 65534;
pub const MAX_INPUT: c_int = 512;
pub const MAX_CANON: c_int = 256;
pub const ARG_MAX: c_int = 1048576;
pub const BC_BASE_MAX: c_int = 99;
pub const BC_DIM_MAX: c_int = 0x800;
pub const BC_SCALE_MAX: c_int = 99;
pub const BC_STRING_MAX: c_int = 0x800;
pub const CHARCLASS_NAME_MAX: c_int = 14;
pub const CHILD_MAX: c_int = 128;
pub const COLL_WEIGHTS_MAX: c_int = 4;
pub const EXPR_NEST_MAX: c_int = 32;
pub const NZERO: c_int = 20;

@tgross35 tgross35 Jun 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leave them in the existing order, helps avoid conflicts when backporting. (Applies a couple places)

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread src/unix/bsd/freebsdlike/freebsd/mod.rs Outdated
Comment on lines +3585 to +3594
/// This symbol is prone to change across releases upstream.
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
///
/// Max bytes in a file name.
pub const NAME_MAX: c_int = 255;
/// This symbol is prone to change across releases upstream.
/// See the [usage guidelines](crate::#usage-guidelines) for details and use.
///
/// Max supplemental group id's.
pub const NGROUPS_MAX: c_int = 1023;

@tgross35 tgross35 Jun 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these have a doc comment, leave that line first and the notice after - the doc is more important as a summary. Same reordering note as above, too.

Also you may as well fix the s/id's/IDs typo

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dybucc dybucc force-pushed the _max-deprecation branch from 1a18c7d to 25c00eb Compare June 24, 2026 14:58
@rustbot

This comment has been minimized.

@dybucc dybucc force-pushed the _max-deprecation branch 2 times, most recently from fff0d1c to d8d00e9 Compare June 25, 2026 07:12
@rustbot

rustbot commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@dybucc dybucc force-pushed the _max-deprecation branch from 612b733 to 30b9bfa Compare June 25, 2026 07:23
Add documentation to certain constants. They are unstable upstream. They
need usage advice. This patch links to it.
@dybucc dybucc force-pushed the _max-deprecation branch from 30b9bfa to d5a8d06 Compare June 25, 2026 07:24
@dybucc

dybucc commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@tgross35 PR should be ready now. Docs links are fixed. Wording is also fixed.

@rustbot ready

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgross35 tgross35 changed the title crate: annotate unstable *MAX constants Annotate unstable *MAX constants Jun 26, 2026
@tgross35 tgross35 added this pull request to the merge queue Jun 26, 2026
Merged via the queue into rust-lang:main with commit 1b06eb5 Jun 26, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants